package com.kongmou.springDataJpaAdvanced.dao.impl;

import com.kongmou.springDataJpaAdvanced.dao.BaseDaoRepository;
import com.kongmou.springDataJpaAdvanced.domain.Person;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public interface PersonRepository extends BaseDaoRepository<Person, Long>{
	
	List<Person> findByName(String name);
	
	//@Query("select name, age, address from person")
	//List<PersonView> useSql();
	
	default List<PersonView> selectPersonBysql(){
		String sql = "select name, age, address from person where name like :name";
		Map<String, Object> params = new HashMap<>();
		params.put("name", "%"+ "飞" +"%");
		List<PersonView> person = selectBySql(sql, params, PersonView.class);
		return person;
	}
	


}
